@model TimeManager.Domain.Entities.Task

@* This partial view defines form fields that will appear when creating and editing entities *@

<div class="editor-label">
    @Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.TimeStart)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.TimeStart)
    @Html.ValidationMessageFor(model => model.TimeStart)
</div>

<div class="editor-label">
    @Html.LabelFor(model => model.Duration)
</div>
<div class="editor-field">
    @Html.EditorFor(model => model.Duration)
    @Html.ValidationMessageFor(model => model.Duration)
</div>

<div class="editor-label">
    User
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.UserId, ((IEnumerable<TimeManager.Domain.Entities.User>)ViewBag.PossibleUsers).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Name), 
        Value = option.UserId.ToString(),
        Selected = (Model != null) && (option.UserId == Model.UserId)
    }), "Choose...")
    @Html.ActionLink("Create new User", "Create", "Users")
    @Html.ValidationMessageFor(model => model.UserId)
</div>
<div class="editor-label">
    Project
</div>
<div class="editor-field">
    @Html.DropDownListFor(model => model.ProjectId, ((IEnumerable<TimeManager.Domain.Entities.Project>)ViewBag.PossibleProjects).Select(option => new SelectListItem {
        Text = (option == null ? "None" : option.Name), 
        Value = option.ProjectId.ToString(),
        Selected = (Model != null) && (option.ProjectId == Model.ProjectId)
    }), "Choose...")
    @Html.ActionLink("Create new Project", "Create", "Projects")
    @Html.ValidationMessageFor(model => model.ProjectId)
</div>
